<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <link rel="STYLESHEET" href="../SMS/styles/project.css" type="text/css">
        <%@ include file="isComm.jsp"%>            
        <%@ include file="..\master\head.jsp"%>        
        <script>
            function isGPACorrect(t)
            {
                inno = document.getElementById(t)  ;
                alert(inno);
                if (  parseFloat(document.getElementsByName(GPA).value )>5)
                    {	inno.innerHTML = 'Invalid GPA (should be less than five).';}
                else if (  parseFloat(document.getElementsByName(GPA))<0)
                    {	inno.innerHTML = 'Invalid GPA (should be greater than zero).';}
                else	
                    return true;
            }
        </script>
    </head>
    
    <body onload="getTitle()">
        <div id="container">
            <div id="wrapper">
                <div id="sidebar">
                    <div id="sb_top"><%@ include file="..\master\sbTop.jsp"%>
                   </div>
                    
                    <div class="sb_content"><!--##########--> <!-- Start Menu --> <%@ include
         file="..\master\Profmenu.jsp"%> <!-- Profile -->
<%@ include file="..\master\profile.jsp"%> <!-- links -->
<%@ include file="..\master\links.jsp"%>
                        <div class="copyright"><%@ include file="..\master\copyright.jsp"%>
                        </div>
                    </div>
                <!-- /sb_content --></div>
                <!-- /sidebar --> <!-- Top -->
                <div id="header"><%@ include file="..\master\header.jsp"%>
                </div>
                
                
                <!-- Start main content -->
                <div id="content">
                    <div id="intro">
                        <div class="intro_t">
                            <h1><span>..</span>Welcome to<span>..</span></h1>
                            <h2>student project management system</h2>
                            
                        </div>
                    </div>
                    <!-- /intro -->
                    <h1> Edit Student GPA </h1><br>
                    <%@ page import="java.io.*, java.text.*, java.util.Date, java.sql.*, java.util.*, database.DBCon" %>
                    <form action="updateGPA.jsp"  onsubmit="return isGPACorrect(this)">
                        <table align="center" >
                            <th align="center">Student ID</th><th align="center">Student Name</th><th align="center">GPA</th>
                            <%
            DBCon db = new DBCon();
            ResultSet res = db.getStudent("");
            String id;
            while (res.next()) {
                id = res.getString("id");
                out.print("<tr align='center' ><td> <input  type='text' size='1' name='id' value='" + id + "' /> </td><td>" + res.getString("firstName") + " " + res.getString("lastName") + "</td><td><input type='text' name='GPA' value='" + res.getString("gpa") + "'  onblur='if (parseFloat(value)>5 || parseFloat(value)<0) {alert(\"value should be between 0 and 5\");value = 0;};value = parseFloat(value);' /> </td><td><div id='" + id + "' class='required'></div></td></tr>");
            }
                            %>
                            <tr><td></td><td><input type="submit" value="Update GPA"  /></td><td></td></tr>
                            
                        </table>                
                    </form>
                </div>
                <!-- /content -->
                
            </div>
            <!-- /wrapper -->
            <div class="clear">&nbsp;</div>
        <!-- Important! Fix the problem of height in Firefox --></div>
        <!-- /Container -->

        
    </body>
</html>